#!/usr/bin/env python

import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from runtest_dalton import Filter, TestRun

test = TestRun(__file__, sys.argv)

f = Filter()

f.add(from_string = 'Polarizable embedding energy contributions:',
      num_lines = 16,
      abs_tolerance = 1.0e-6)

f.add(from_string = 'Final results from SIRIUS',
      num_lines = 12,
      abs_tolerance = 1.0e-6)

test.run(['save_density.dal'], ['monomer.mol'], ['monomer.pot'], args='-put "core.h5" -get "core.h5"')
os.rename('save_density_monomer_monomer.core.h5', 'save_density.h5')

test.run(['twoint.dal'], ['core_monomer.mol'], args='-put "save_density.h5" -get "save_density.h5"')
os.rename('twoint_core_monomer.save_density.h5', 'twoint.h5')

test.run(['pde.dal'], ['core.mol'], ['monomer.pot'], f={'out': f}, args='-put "final.h5"')

sys.exit(test.return_code)
